package mortal.game.control
{
    import Message.Game.*;
    import modules.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.info.*;
    import mortal.mvc.core.*;
    import mortal.mvc.interfaces.*;

    public class GuideMovieController extends Controller
    {

        public function GuideMovieController()
        {
            
        }

        private function onGuideWeaponStrengThen(event:DataEvent) : void
        {
            (view as IGuideMovieModule).updateMovie(EventName.Guide_MovieWeaponStrengthen);
            view.show();
            
        }

        private function onGuideRefrshPetGrowth(event:DataEvent) : void
        {
            (view as IGuideMovieModule).updateMovie(EventName.Guide_MovieRefreshPetGrowth);
            view.show();
            
        }

        private function onGuideWeaponStrengThenReq(event:DataEvent) : void
        {
            var _loc_2:* = event.data as ItemData;
            GameProxy.guideProxy.weaponStrengthenTask(_loc_2.posType, _loc_2.uid);
            
        }

        private function onGuideRefreshPetGrowthReq(event:DataEvent) : void
        {
            var _loc_2:* = event.data as SPetInfo;
            GameProxy.guideProxy.refreshGrowthTask(_loc_2.uid);
            
        }

        private function onWeaponStrengthenRes(param1:Object) : void
        {
            MsgManager.addBroadCast("完成打造指引，装备强化成功，请查看");
            (view as IGuideMovieModule).onStrengThenRes();
            
        }

        private function onRefreshGrowthRes(param1:Object) : void
        {
            MsgManager.addBroadCast("完成洗练指引，宠物成长提高，请查看");
            (view as IGuideMovieModule).onRefreshRes();
            
        }

        override protected function initServer() : void
        {
            Dispatcher.addEventListener(EventName.Guide_MovieWeaponStrengthen, this.onGuideWeaponStrengThen);
            Dispatcher.addEventListener(EventName.Guide_MovieRefreshPetGrowth, this.onGuideRefrshPetGrowth);
            Dispatcher.addEventListener(EventName.Guide_MovieWeaponStrengthenReq, this.onGuideWeaponStrengThenReq);
            Dispatcher.addEventListener(EventName.Guide_MovieRefreshPetGrowthReq, this.onGuideRefreshPetGrowthReq);
            NetDispatcher.addCmdListener(ServerCommand.GuideWeaponStrengthenRes, this.onWeaponStrengthenRes);
            NetDispatcher.addCmdListener(ServerCommand.GuideRefreshGrowthRes, this.onRefreshGrowthRes);
            
        }

        override protected function initView() : IView
        {
            var _loc_1:* = new GuideMovieModule();
            _loc_1.layer = LayerManager.windowLayer;
            return _loc_1;
        }

    }
}
